#include <iostream>
#include <cstring>
#define MAXN 1005
using namespace std;
int N, d;
typedef pair<int, int> Com;
Com computers[MAXN];
int par[MAXN];
int ranks[MAXN];

int find(int x) {
    if (par[x] == -1) return -1;
    if (par[x] == x) return x;
    return par[x] = find(par[x]);
}

void unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return;
    if (ranks[x] < ranks[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (ranks[x] == ranks[y]) ranks[x]++;
    }
}

bool same(int x, int y) {
    return find(x) == find(y);
}

int distance(int i, int j) {
    int a = computers[i].first - computers[j].first;
    int b = computers[i].second - computers[j].second;
    return a * a + b * b;
}

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin >> N >> d;
    for (int i = 1; i <= N; i++) {
        cin >> computers[i].first >> computers[i].second;
    }
    solve();
}

void solve() {
    memset(par, -1, sizeof par);
    memset(ranks, 0, sizeof ranks);
    char type; int x, y;
    while (cin >> type) {
        if (type == 'S') {
            cin >> x >> y;
            if (same(x, y) && find(x) != -1) {
                cout << "SUCCESS" << endl;
            } else {
                cout << "FAIL" << endl;
            }
        }
        else {
            cin >> x; par[x] = x;
            for (int i = 1; i <= N; i++) {
                if (par[i] != -1 && distance(x, i) <= d * d) unite(x, i);
            }
        }
    }


}